<template>
  <div class="application-item-box">
    <div class="item-box-contant typeCloud">
      <div class="box-left" @click="gotoDetails(itemData.id)">
        <van-image width="100" height="100" radius="20" :src="itemData.icon" />
      </div>

      <div class="box-center">
        <div class="box-center-top">
          {{ itemData.name?.length > 16 ? itemData.name?.slice(0, 16) + '...' : itemData.name }}
        </div>
        <!-- <div
          class="box-center-bottom"
          :style="{
            color: textColor,
          }"
        >
          空岛集结
        </div> -->
        <van-button
          type="primary"
          size="small"
          class="down-btn"
          @click="openUrl(itemData.play_url)"
          >{{ $t('startgame') }}</van-button
        >
      </div>
    </div>
  </div>
</template>

<script setup>
import { RouterView, useRoute, useRouter } from 'vue-router'
const router = useRouter()
const props = defineProps({
  itemType: {
    type: String,
    default: 'advertising', //advertising  cloud
  },
  buttonColo: {
    type: String,
    default: '', //按钮颜色
  },
  itemData: {
    type: Object,
    default: {}, //advertising  cloud
  },
  windowURL: {
    type: String,
    default:
      'https://img.zcool.cn/community/0102c65f8d2d2f11013e45843d8bce.jpg@1280w_1l_2o_100sh.jpg', //advertising  cloud
  },
  textColor: {
    type: String,
    default: 'fff', //文本颜色高度
  },
})
const gotoDetails = (id) => {
  console.log('gotoDetails', id)
  router.push({
    name: 'gameDetails',
    query: {
      id: id,
    },
  })
}
const openUrl = (play_url) => {
  if (play_url) {
    window.open(play_url)
  }
}
</script>

<style lang="scss" scoped>
.application-item-box {
  display: flex;
  align-items: center;
  .item-box-contant {
    display: flex;
    align-items: center;
    width: 100%;
  }
  .box-left {
    width: 80px;
    display: flex;
    justify-content: center;
  }

  .typeCloud {
    padding: 10px 0;
    flex-direction: column;
  }
  .typeCloud .box-left {
    display: flex;
    justify-content: center;
    justify-content: flex-start;
    width: auto;
    // margin-right: 12px;
  }

  .typeCloud .box-right {
    width: auto;
  }
  .box-center {
    flex: 1;
    display: flex;
    align-items: center;
    flex-direction: column;
    .box-center-top {
      font-weight: bold;
      margin-top: 6px;
      // margin-bottom: 4px;
      font-size: 15px;
    }
    .box-center-bottom {
      font-size: 13px;
      margin: 10px 0;
    }
  }
  .box-right {
    width: 90px;
  }
  .down-btn {
    font-weight: bold;
    background: rgb(245, 245, 245);
    border-color: rgb(245, 245, 245);
    color: #0d7ffe !important;
    padding: 8px 10px !important;
    font-size: 12px;
    margin-top: 6px;
  }
  .white-color {
    color: #fff;
  }
}
</style>
